Updated with minor formatting and boost::shared_ptr extensions