Added ability to give custom validation messages.
Refactored validator.