integrated the stuff from the pull request