Continued refactoring to handle arbitrary board size