We use past perfect for completed actions in the past that happened before other completed past actions e.g. I had never visited Romania before last year.
Time expressions: already, after, before, by the time, when, for, since, as soon as.
POSITIVE SENTENCES ('d/had + past participle)
I/you/he/she/it/we/they had eaten before going for a walk.
I had already married Diana before I fell in love with Josie!
After we had met we became good friends.
As soon as she had mended the hole in her trousers, they ripped again.
Once they had mixed the flour, they added raisins.
NEGATIVE SENTENCES (had not/hadn't + past participle)
I/you/he/she/it/we/they had not (hadn't) eaten before going for a walk.
We hadn’t moved the sofa by the time they arrived. That’s why they were angry when they came home.
The dog hadn’t obeyed Thomas when he told it to go home.
When we went for a visit they hadn’t offered us any tea.
She hadn’t opened the machine to see if it was working before she rang the Service Department.
QUESTIONS (had + past participle)
Had I/you/he/she/it/we/they eaten before going for a walk?
Had she packed her bags by the time the taxi arrived?
Had the class painted landscapes before?
Had Mike and Andrea parted before he moved to Uzbekistan?
Had Joss passed Mark by the time they had reached the half way line?