Fixed local db search error. Was searching for the wrong text string. Also added comments for clarity.