move process spawning to a separate module