improve code for ppu.