safety checks in SQL, updated schema (not implemented yet)