Introduced a function to handle and validate user input, improving the robustness of the input processing workflow.