Reformatted and added key press events