More unit test fixes and style cleanup