transfered some code to GameBoard class