started implementing function for validating user input.