added switch functionality