setup search and rewote ajax calls