Added support for JPEG and SVG; added image format filter to prevent bad calls; added file download support; some refactoring