refactoring board code