changed order of FOREACH arguments

also removed some trailing whitespace