finished with higher order functions