working well now, adding plotting macros as well