Implemented recursive validation and refactored some.