This branch contains all the uncommited patches from issue #905 (closed).
Closes issue #905 (closed).