Initial pull request for #1140