minor speedup improvements