Better logic for initial image loading