Finish implementing database functionality.