Changed to store template as json object instead of dict