Improved templating for even more duplication reduction.