read boost::ref or use pointers to pass data to the functions