Reorganizing board controller and refactoring checkBoard function