image thumbnails refactor