refactoring, removing cleanup macro, adjusting rest of code, renamed macros.h to macro.h