public void undo(){
		
		if (Controller.getMode() == Controller.Mode.BACKSTITCH){
			if (lineStack.size()==0){
				return;
			}
			Line l = lineStack.peek();
			ArrayList<Line> deleted = new ArrayList<Line>();
			//find corresponding line in "lines" list
			int index = lines.indexOf(l);
			if (index!=-1){
				Line lineToErase = lines.get(index);
				deleted.add(lineToErase);
				lines.remove(index);
				scaleBI();//force it to recognize that a line is missing
				repaint();
				lineStack.pop();
			}
			
		}
		else if (Controller.getMode() == Controller.Mode.PAINT){
			if (squareStack.size()==0){
				return;
			}
			Square s = squareStack.peek();
			Controller.paint(s.getCol(), s.getRow(), s.getColor());
			//scaleBI();//force it to recognize that a line is missing
			repaint();
			squareStack.pop();
		}
		else if (Controller.getMode() == Controller.Mode.ERASE){
			//TODO ?
		}
		else if (Controller.getMode() == Controller.Mode.PBUCKET){
			if (pbStack.size()==0){
				return;
			}
			ArrayList<Square> sList = pbStack.peek();
			for (Square s : sList){
				Controller.paint(s.getCol(), s.getRow(), s.getColor());
			}
			repaint();
			pbStack.pop();
		}
	}