Updated for language changes, removed deprecated code.