change type of bits from byte to uint8_t
refactored the - sing to be a complete if else form