Fix shrinkDatabase(), cleanup code.