Feature/134 code fixes

Sorry, this should actually be #31, I was on the train when I wrote this and guessed the branch.