Work on #196
Tests for #196 and #202