improved database scripts