Syntax cleanup and minor refactoring.