refactoring
adding a loading spinner