More clean up after debugging, use lambda function to replace std::bind