Add function checkBoard() to make program readable