track duplicates code tested and fixed
fixed bugs in code, now works