rewrite backward pawn code

No functional change.