Refactored for user input