Adding loading icon to restart popover, refactoring