4th draft

Put the validation code at the top