Used shared_ptr throughout

This PR brings in changes from the long-running shared_ptr feature branch, merged with the latest from brownie/master.