Modified code in order to allow parallel run via SCOOP

- Code is super ugly now, needs cleaning for further modification