Clean up the input setup and error handling