add search and fixed bugs