Use a macro for the for loops