Refactor js to allow overriding default options, fixed bug with small image sizes not displaying thumbnails