Refactor the output dependency tracking piece into a context.