More cleanup/conversion.

Mostly changes to get utils to work as module.