adding thumbnail support and other minor adjustments