Added some comments and did sonar fixes