Rebased #1138

Rebased #1138
Closes #1138