Code clean up and handling FIFO errors

Revision:
69:4305ac772a66
Parent:
67:d36977cbfe90