Code cleanup phase 2: p-percent