Some database code cleanups.