Messy but is a major rewrite