Code clean up and handling FIFO errors

Revision:
69:4305ac772a66
Parent:
57:c6275de14bc5