prim cleanup