Refactoring

Refactoring, bug fixing. Make it work
Fix pep8 warnings
Move templates to templates dir
Fix jinja templates folder reference