Added process cleanup, which will hopefully fix bugs where background processes cease to be started.