Minor changes
Refined function MoveIsLegal