adding respawn event and cleaning up code