Modified Adding subjects to classes and vice versa to avoid duplication and exceptions