cleaned pmem.c