initAndSplit and gatherFunction implemented(not tested)