Refactored MapElements to be used as boost::shared_ptrs instead of regular pointers