working code for the pull request