Small cosmetic fixes and code organization