Rename functions, make json retrieving function smaller.