Key input handling inserted