preliminary refactoring to make jenkins process code more self contained.