revising search file method to make it more generic