Updated method arrayKeysPressed