moved validation into form