All validation working and clean up.
Validation, refactoring and cleanup.