Reduce memory overhead and GC churn

Utilize only 2 sets instead of instantiating a new set on each courseID
iteration - should reduce memory overhead and garbage collector churn.