Let's fix up this abominable code