finished database part