Cleaned up some code.
And created a validation class.