starting complete rewrite