moved validation to its own file