moved validate stuff into its own module