small whitespace and comments changes
Moved a number of flow hooks to the settings library, where they should be