Make sure to pass correct datatype to validate
Distinguish errors during read/write
Remove shebang line because module is no longer callable
Use dirname rather than split
Return the list of errors, rather than the number of errors