Licence added
minor template-related bugfixes