Improved loading logic