Yep, this is ugly and needs tidying up especially as it's used a couple of places now.