4 PAST SIMPLE vs. PAST PERFECT SIMPLE
The PAST PERFECT SIMPLE (HAD DONE, HAD EATEN) tells you that one thing in the past happened before another thing in the past. If we list events in chronological order we usually use the Past Simple.
The Past Perfect Simple is used to clarify the sequence of events when we break that chronological order.
just, already, before, when, how many times...?
e.g. When Paul arrived at the theatre his girlfriend had already left.
Past perfect tense in time clauses
-In time clauses after when we can use either the past simple or the past perfect
We use the past simple tense if we want to say that the first activity led to
the second and that the second followed the first very closely.
When the film ended he switched off the television.
The past perfect is used when we want to make it clear that the first action was
completed before the second started and that there is no relation between them.
When she had washed the dishes she had a cup of tea.
When she washed the dishes she put the plates in the cupboard.
-If we use AFTER in a time clause the past perfect is much more usual.
After Zidane had scored the goal the fans went wild.
-We use this tense similarly with: as soon as, until, before, by the time.
He got up as soon as he had heard the alarm clock.
We did not stop until we had reached the coast.
Maria had finished her meal by the time I arrived.
Before she cut her hair she had consulted it.
Source: don´t remember, but I think it is: http://www.e-grammar.org
Hope it helps...!