Added a global loading function