Small improvements to the code and comments