Added utility function to manage busy loading and error handlingw