Refactored validation to work with ng-messages