ohh, this really needs a rewrite