Clean ups and fixes from code analysis