change some manual currying to Function.bind