code refactoring of Board class