modified to run on 4 cores (can be executed on a local cluster)