The Art and Science of Nested Loops