refactor thumbnail generation