rewrite cleanPhy