Made changes as per code review feedback

#2637
Fixed some code analysis errors

#2637