Move more testable logic to small fns in utils

- Name functions as nouns, since they don't modify state.
- Move re import to utils