Added DB code. Index is mostly building now.