Large refactoring

* templates
* localization
* tests