refactor
Remember to detach subprocesses