function cleanup
add thumbnail support