Composing with higher order functions