logic fixes.  endgame cases added.