refactoring of cubeboard class