UCB rewrite and tests