Refactoring of displayBoard() method