memory and speed improvements