put back the validate function. For some reason it was deleted