use 'uint8_t' instead of 'unsigned char'
fixed indent, newlining, and other miscellenea