Better handling of attributes in templates