refactored some code and fixed few grammatical mistakes.

Formatted code using code style of 2 spaces per indent. It seems as though the author wanted it this way seeing as he or she had already done that previously.

Replaced the if statements in printError method to stop code redundancy. 

Changed byte1 to firstByte to make code more readable.

Added a few comments to make the code make more sense.