refactored object spawning