altered print db functions to have an index if wanted