Terribly ugly solution.