updated c++ implement
deleted extraneous