avoid using (new Set()).forEach

forEach is not implemented in v8 that is packaged with the stable version of node (0.10.29)

so when using node --harmony the code fails

Replaced the implementation with the one from https://github.com/Benvie/harmony-collections
((The MIT License) Copyright (c) 2012 Brandon Benvie http://bbenvie.com)