refactor ProgramLoader, RunProcess to remove static state

**please review**
Please have a look at #1102 and tell me if this changes things.