dbtool refactor