Context class, misc cleanup.