moved process factory out into common lib