works for the most part... still some issues with when the loading is triggered