Ensuring loading animation is smooth