Initial rewrite for 1.7