DB code clean up