Cosmetic improvements to the code