Refactoring and thumbnails implementation