updated to allow more than 2 treatment conditions