Factor out opMemo