Moved board code to board function