More fixes and speed improvements