Refactored input handlers