Closes #586