Updating loading function