Functional updateBoard function