Code duplication in templates removed