added faster code to remove_duplicates to gt.py