rewrite in base