[DB]Refactor code.