a major refactoring of macro compilation