refactor and update input module