refactor of the Distributed ensemble for arbitrary map/reduce functions