separate try-spawn-piece and spawn-piece functions