Remove duplicated code in doinBackground: any function called from that can access publishProgress(). Made integer for length of json so no recalculating necessary