Thumbnail generation reworked