initial commit of rewrite, needs restructured