Factor out CONTEXT out of older mapping code.