Added nil data checks to avoid crashes when using an unreliable internet connection (untested)