Re-factored the validation module for readability.