added for and with macros
removed more of the foreach's