Refactored plugin mem.