Scientists shed light on how brains turn pain up or down