template mapping improvements