Minor improvements to the code.