Fixed up some of the search js code