refactor the Board code following the DRY