Your comments

It counts last 2n shares. So if you mine in the begining of the block, but then you stop, and the block takes longer than 100% of expected work, it will start forgetting the first shares. That is the point of PPLNS - to make it harder for pool jumpers.