Some cleanup, trying to make sense of old code...