modified to run on several nodes