refactor delete macro