replaced the validMoves code because the other stuff didnt work right