Ugly, but works.