Finish database implementation