Some readability improvements to the code