Clean up deprecated code.

Replace deprecated code with new preferred methods.