organize the code to support multiple search algoritms