added some higher-order function stuff