use object instead of pattern for using validation functions