Made some changes after running static analysis tool.