Refactoring using MemRef.