Code clean up and handling FIFO errors

Revision:
69:4305ac772a66
Parent:
65:d91e1d63153d