added validation.py plus minor changes to other code