some speedup code
before another speed attempt
more speed fixes