changed code for cluster runs