Refactoring user validation