added support for previews and thumbnails