add implementation for macro that adds an index