split the inner loop for 10% speedup