Added loading indicator function