database implementation