changed to be async and put spinner