improve code with comments