General stylistic improvements and helper functions.