Whitespace changes

@drj11 and I explored the code to understand it better and in the meantime
tidied it up a bit.