Clean up input handling