moved tableView reloadData to the main thread for efficiency