remove unused explicit enum values
use scan code state
add function to insert scan code into buffer
remove unused variable