Closes #1535 and #1577