Changing environments to use shared_ptr

Living in 2014