#4 tidying keyboard code