Spawn resource refactor

massive refactor of spawn_resources script