cleaning up, speed improvements