code refactored in order to remove usage of deprecated code