#3 added support for regenerate thumbnails and widget logic