Cleanup and slight reorganization.