Moved functionality to ImageBlock class;
Added caching for thumbnails