replaced some deprecated code