Refactoring and cleaning up subprocesses.