bunch more template improvements