Improved thumbnails fetching function