Fix initial conditions.

Factored out database code. Fixed handling of empty database. Updated
binary.