Clean up code

Use uint8_t rather than char && casts.
Don't assign to variables inside of an "if" condition.  It's
bad form.