refactor the Input.hold* code