Some code cleanup and better formatting.