time for some rewrite