Make compatible with heroku
Better templating functions - fixes #4