Improve long-running process handling as described in #8