Replace deprecated code