fixed more bugs and now the search works.