To use who, that and which correctly you'll need to remember the following;
Who and sometimes that refer to people in a sentence.
That and which refers to groups or things in a sentence.
Gandalf is the wizard who is mighty and powerful.
Who is correct as it refers to Gandalf who is a person.
It was the army of Orcs that caused an awful mess.
That is correct as it refers to a group of Orcs.
That is used in a sentence to introduce an essential clause. An essential clause adds vital information to a sentence.
I do not trust that Orc who is mean.
That is correctly used as it introduces the essential clause of the Orc being mean, which is why he can't be trusted.
Which is used to introduce a nonessential clause within a sentence. A nonessential clause adds additional information to enhance a sentence.
I liked Gandalf's firework display, which was breath taking.
The fact that Gandalf's firework display was breath taking was not an essential clause of a sentence and therefore which is correct. The essential clause was I liked Gandalf's firework display.
Related posts on grammar
Tips for writers
Book reviewsThe Prince of Thorns by Mark Lawrence
Jonathan Strange & Mr Norrell by Susanna Clarke
Dead until dark by Charlaine Harris