Added if statement to check if any errors were detected in user input