Code cleanup

Moved checkValidity in dValidate