Refactors code in board.rb