Remove previously deprecated code and general cleanup