modified allMoves() to put checks in the front.