changed deprecated code to new version code