finished validator function