static void Main(string[] args)
        {
            using (new MPI.Environment(ref args))
            {
                if (Communicator.world.Rank == 0)
                {
                    System.Console.WriteLine("Hello from the 0-Rank computer!");

                    RGBDisplayModel model = new RGBDisplayModel();

                    Bitmap        originalImage     = (Bitmap)System.Drawing.Image.FromFile("D:\\Anu3\\Sem1\\Programare paralela si distribuita\\Laborator\\MPIProject\\MPIProject\\img.bmp");
                    var           originalImageCopy = new Bitmap(originalImage);
                    BufferedImage bufferedImage     = new BufferedImage(originalImageCopy);

                    model.setOriginalImage(bufferedImage);

                    //TODO: we have 12 core, but one core is the main one => one core remaining -> currently the program is done to use 13 cores !!!! BUG

                    int redMask   = unchecked ((int)0xFFFF0000);
                    int greenMask = unchecked ((int)0xFF00FF00);
                    int blueMask  = unchecked ((int)0xFF0000FF);

                    DateTime start = DateTime.Now;

                    BufferedImage redResult       = MPIMaster(model, redMask);
                    Bitmap        redResultBitmap = redResult.getBitmap();
                    redResultBitmap.Save("D:\\Anu3\\Sem1\\Programare paralela si distribuita\\Laborator\\MPIProject\\MPIProject\\imgRedResult.bmp", ImageFormat.Bmp);
                    System.Console.WriteLine("Red filter DONE.");

                    BufferedImage greenResult       = MPIMaster(model, greenMask);
                    Bitmap        greenResultBitmap = greenResult.getBitmap();
                    greenResultBitmap.Save("D:\\Anu3\\Sem1\\Programare paralela si distribuita\\Laborator\\MPIProject\\MPIProject\\imgGreenResult.bmp", ImageFormat.Bmp);
                    System.Console.WriteLine("Green filter DONE.");

                    BufferedImage blueResult       = MPIMaster(model, blueMask);
                    Bitmap        blueResultBitmap = blueResult.getBitmap();
                    blueResultBitmap.Save("D:\\Anu3\\Sem1\\Programare paralela si distribuita\\Laborator\\MPIProject\\MPIProject\\imgBlueResult.bmp", ImageFormat.Bmp);
                    System.Console.WriteLine("Blue filter DONE.");

                    double time = (DateTime.Now - start).Milliseconds;
                    System.Console.WriteLine("MPI elapsed time: " + time.ToString() + " milliseconds.");

                    System.Console.WriteLine("DONE!");
                }
                else
                {
                    MPIWorker();
                    MPIWorker();
                    MPIWorker();
                    //System.Console.WriteLine($"Hello from the {Communicator.world.Rank + 1}-th child!");
                }
            }
        }
        private static BufferedImage MPIMaster(RGBDisplayModel model, int mask)
        {
            int n = Communicator.world.Size;

            ArrayList <BufferedImage> chunks = model.splitImage(model.getOriginalImage(), 100);

            for (int i = 1; i < n; i++)
            {
                ArrayList <ImageIcon> imageList = new ArrayList <ImageIcon>();
                for (int j = 1; j < n; j++)
                {
                    try
                    {
                        imageList.Add(new ImageIcon(chunks[(i - 1) * (n - 1) + (j - 1)]));
                    }
                    catch { Exception e; }
                    { }
                }
                Communicator.world.Send(imageList, i, 0);
                Communicator.world.Send(mask, i, 0);
            }

            ArrayList <ImageIcon> resultsIcon = new ArrayList <ImageIcon>();

            for (int i = 1; i < n; i++)
            {
                ArrayList <ImageIcon> aux = Communicator.world.Receive <ArrayList <ImageIcon> >(i, 0);
                resultsIcon.AddAll(aux);
            }

            ArrayList <BufferedImage> results = new ArrayList <BufferedImage>();

            //Convert imageIcon to BufferedImage
            foreach (ImageIcon image in resultsIcon)
            {
                results.Add(convertToBufferedImage(image.getImage()));
            }

            BufferedImage resultImage   = new BufferedImage(model.getOriginalImage().getWidth(), model.getOriginalImage().getHeight(), model.getOriginalImage().getType());
            int           howManyOnLine = (int)Math.Sqrt(results.ToArray().Length);


            for (int i = 0; i < howManyOnLine; i++)
            {
                for (int j = 0; j < howManyOnLine; j++)
                {
                    resultImage.createGraphics().drawImage(results.ElementAt(i * howManyOnLine + j), 100 * i, 100 * j, null);
                }
            }

            return(resultImage);
        }