Refactoring and style updates.