Replace ugly function pointers, with boost::function and boost::bind