Compiles on win

* Windows fixes
* Templates are working again