refactor functions in Board class