Rewrote parts of the flanking code, simplified Piece::moveToValid