Adding new code for terms list.  #1
Fixing bug in API code that uses wrong database counting function.