Added data validation, protected pk fields from writing, cleaned .py files, fixed minor errors