public void sortList() {

		ArrayList<Object> genericList = null;
		ArrayList<Item> out = null;
		
		if(parent instanceof MainPanel){
			genericList = ((MainPanel) parent).getSortPanel().retrieveCats();
			out = DataManagement.getInventorySubset(player.getInventory(), genericList);
			out = DataManagement.alphaSortedList(out);	
			if(((MainPanel) parent).getSortPanel().getCurrentSort() != -1){
				out = DataManagement.getSortedList(out, ((MainPanel) parent).getSortPanel().getCurrentSort());
			}
		}
		else{
			genericList = Launcher.getFavPanel().getSortPanel().retrieveCats();
			out = DataManagement.getInventorySubset(player.getInventory(), genericList);
			out = DataManagement.alphaSortedList(out);	
			if(Launcher.getFavPanel().getSortPanel().getCurrentSort() != -1){
				out = DataManagement.getSortedList(out, Launcher.getFavPanel().getSortPanel().getCurrentSort());
			}
		}
		
		
		for(GridElement ge: currList){
			ge.setVisible(false);
		}
		
		currList.clear();
		System.out.println("OUT SIZE " + out.size());
		for(Item i : out){
			GridElement newGE = getElementFromItem(i);
			if(parent instanceof MainPanel){
				add(newGE);
				currList.add(newGE);
				newGE.setVisible(true);
			}
			//For fav panel, ensure that this GE is favorited
			else if(newGE.isFavorite()){
				add(newGE);
				currList.add(newGE);
				newGE.hideFavIcon();
				newGE.setVisible(true);
			}
		}
		
		System.out.println("RESULTANT SIZE " + currList.size());
		refreshLayout();
		
	}