finished database controller