Move DB stuff to dedicated module