validate() standalone function now fully working