separate DB code