Security layers now working and refactored schema validation and added schema iteration