Refactor DB code in CLI

Replace malfunctional code (sleep deprivation… oops…)