Converted queue-action function into a macro. Used an agent to contain the document's buffer.