Improved performance for larger images.