Rearrange library code and enable svg, png download.