Upgraded to newer library versions. Converted from Mako to Jinja2.
Simplified random image logic.
Added requirements file with new requirements.