db rewrite - in progress