Merge extract to db

@ardila I think i've merged this as needed.   can you look at this branch and see if still functions as needed?    if so then merge to master.