Moved validations to a module with methods so that it can be used outside validators