Added algorithm to search for keywords and write to file