General code cleanup.
Moved this somewhere else.