refactor ProgramLoader, RunProcess to remove static state