Incorporate comments and fixed a code analysis error