from Meina Zhou

the main py and the validation functions, haven't separated the exception classes yet. Will sort all the files later.