removing duplicate courses

But also prevent courses to be mandatory that do not have to be
mandatory