Moved logic from memory to memory set