- optimized the transformation to be one-pass and much faster
- fixed remove setable and remove duplicates to use a real transformation