Tiny style/efficiency improvements
Merge pull request #3392 from ussuri/minor-cleanups

Tiny style/efficiency improvements