Add some changes from the pull request