rewrite of most everything