public void run()
    {
        System.out.println("Elevator " + getID() + " has started");
        running = true;
        while (running)
        {
            synchronized(this)
            {
                if (!hasDestinations(floorDestinations))
                {
                    try
                    {
                        idle = true;
                        wait(10000);
                        returnToDefault();
                    }
                    catch (InterruptedException e)
                    {
                        e.printStackTrace();
                    }
                }
            }
            synchronized(this)
            {
                if (hasDestinations(floorDestinations)) 
                {
                    try
                    {
                        wait(3000);
                        if (goingUp && currentFloor < getNumOfFloors())
                            currentFloor++;
                        else if (currentFloor > 1)
                            currentFloor--;
                        System.out.println("Elevator " + getID() + " passing floor " + currentFloor);
                        if (floorDestinations[currentFloor])
                        {
                            doorsOpen = true;
                            System.out.println("Elevator " + getID() + " reached destination: " + currentFloor);
                            wait(3000);
                            doorsOpen = false;
                            floorDestinations[currentFloor] = false;
                        }
                    }
                    catch (InterruptedException e)
                    {
                        e.printStackTrace();
                    }
                }
            }
        }
    }