refactor validation class