CMem rewrite