Code analysis changes

A few changes from running code analysis