Update templates + various bugfixes