This should really be happening in a template