implemented clear_state
optimized guess_byte
indent changes