start of macro handling implementation