minor style improvements and code cleanup