Removed references to jinja
Refactored python code and added comments. Should be more readable