One minor optimiztion to the loop