Improve template flavour detection