Replacing deprecated code