Numerous bug fixes. Removed <template> tests