Made adjustments to resolve function. The current clause is compared against the clauses that are above it.