started factoring of JS to support multiple searches