use boost::shared_ptr instead of raw pointers for more condense code and...

... to fix a memory leak