added key events and else if statements