added search and fixed some errors