merge collapsing functions for X Y E