Work for #218, #219 and #220. Closes #219