Fix for #19

As well as some minor formatting fixes that got though before.