Identify the grammatical function of the bolded noun clause in this sentence:

Michael was determined to find whoever had scratched up the side of his car.
A) subject
B) direct object
C) predicate nominative
D) object of a preposition