Lots of minor speedups