Before removing duplication with higher order functions