Changed keyboard event's if statements into if else