Make templates more modular.
Fix merge conflicts