Closes #1573, #1577 and #1580
Revert "Merge branch 'master' into issue1537"

This reverts commit 62e04f9722f6a8fde2b888d4d2aa68616f69aa78, reversing
changes made to 18a3423ad75fa49957bfcfb94309d5a40718970b.