added extra scope for q in R