Added function to validate user input (glitchy)