refactored for activerecord and for registration validations