major refactoring of FunctionComposition as well as adding fork and scatter