higher-order functions finished (whoo!)