split up tcp118, refinement on higher order functions