some code and comments refinement