This logic should be in the template