refactor which() into top level utils module