refactor greedysearch into one class per file