Use C++11 'auto' keyword for iterators.
Use C++11 'std::make_shared'
Added comments.