Minor cleanup.

Renames and moves around a few functions.