case TAN:
        RS2Widget w = getWidgets().getWidgetContainingText("Hard leather");
        if (w != null && w.isVisible()) {
              w.interact("Tan All");
        } else {
	NPC ellis = npcs.closest("Ellis");
        if (ellis != null && ellis.exists()) {
	    ellis.interact("Trade"); 
            //either put a conditional sleep until interface is open here, or just stick with a static sleep and let state machine do the work eg:
            sleep(random(400,500) + random(400,500));
        } else {
            sleep(random(400,500) + random(400,500));
        }
	break; 
Re-written tan case... change the tan condition in the getState to: 
 if(ellis!=null&& ellis.exists() && inventory.contains(1739))
			//tans hides when at tanner	
			 return State.TAN;