Closes #29 and some work on #25