Refactored the function initializing board.