What's the maximum n of the outer loop (the number of courses a user is in), something like 10? If that's so, you're right, worrying about the loop would be overkill.