Major rewrite for 1.6