Added javascript to download images using Phantomjs. Bug fixes.