Major refactor of searching/indexing, issues #16, #21.