move templates into scripts; fix karma tests