not elegant, but effective