Closes #40, closes #42 and adds tests related to both
Merge remote-tracking branch 'origin/master'