Refactor who and whowhere to use the same function