Added validation to some user input.