applying macro replacement