Add mem_change function