template improvements
template cleanup, remove duplicates