Removed blank line endings and reformatted code
Corrected typo in validation function.