changed loop order for faster benching