finish implementing database