Unrelated code cleanup and moved some functions around.