DB generator. Need testing.