Move function and sum related things into their own modules, and fix a small bug in the bind_function macro.