Remove unused templates, correct remaining bugs