Cleanup todos

Lots of tiny fixes, cleanups, and refactorings.