Closes #201 (closed) Things could be done in a more elegant way, but I'll leave this for another issue: #550 (closed)