Fixed silly cleanup mistakes, added on_delete() and fixed formatting in the state_loader module