initial macro substitution implementation