Switch function added