the logic in determine_existing_combinations is complicated and hard to read. it can be simplified a lot
Activity