public void insert(MazeCell item, MazeCell current){
        int j;

		if(item == null) System.out.println("PROBLEEEEEEEEEM");

      	if(rear == maxSize-1){         // deal with wraparound
        	rear = -1;
			//System.out.println("PROBLEEEEEEEEEM2");
		}
        if (nItems==0){
            queArray[++rear]= item;
			//System.out.println("yoo");
			nItems++;
			//System.out.printf("rear is now %d\n",rear);
        }
        else{
			//System.out.println("PROBLEEEEEEEEEM3");
			//System.out.printf("j is %d\n",rear);
            for(j=rear; j>=front; j--){
				//System.out.println("PROBLEEEEEEEEEM4");
				//System.out.printf("j is %d\n",j);
                if(calculateDistance(item,current)<calculateDistance(queArray[j],current)){//epeidh ola ta kelia ston laburintho exoun apostasi ena
					System.out.println("Let's give priority to the closer ones!");
                    queArray[j+1]=queArray[j];                                              //ousiastika den tha ekteleitai pote auto to if
                }                                                                           //dhladh h UCS se auth th periptvsh tha douleuei san BFS.
                else{
					//System.out.println("PROBLEEEEEEEEEM6");
                    break;
                }
            }
			//System.out.println("yoo2");
            queArray[++rear]=item;
            nItems++;
	   }
                
    }