updated to accomodate databases