Full corr rewrite, should be pp compatible, debugging