Some cleanup of messy old code, still messy.