Refactored input