rewrite some earlier stuff