Fix #1, add file size check, webp support and some cleanup.