Closes #1 thanks to help from @orta