Finished porting the database section of nigori.