Data switching function added.