"had" and "had been" : They come into picture only when we are talking of two past actions and we want to show their chronology.
Case 1: Use "had" when both the action are complete at the time of reference and one action completed before the other.
Example: I had studied hard, so I did well in exam.
Studying and Doing Well in Exam both occurred in past and they are complete, but I did complete my study 1st, then I did well in exam. To show this sequence, I should use "past perfect" then "Simple past".
Case 2: Use "had been" when two actions are in past and one of the actions was continuing till the other occurred.
Example: I had been studying, when the door bell rang.
Here, I was still studying when the door bell rang. So my action was in past and continuous. The older action is "studying", so I should use "had been" to show the sequence.