Clean up handlers, and caching and thumbnails