Added network check to MainActivity