First commit of big rewrite