Reduced the CPU overhead of checking whether all the JSON has been received