Changed the script to use many to many intemediate table.