Restructures the data return and fixes code appropriately for that