refactor: use grep to make code intent clearer