Use who only when referring to humans. Avoid such usages as a company who or a country who or a dog who. For those, that or which is correct.
Contrary to superstition, that is perfectly acceptable when applied to people. The Man That Got Away and The Girl That I Marry, two hit ballads from the mid-twentieth century, were written at a time when the popular culture expected literacy from its songwriters. And don't forget the famous quotation from the Gospel of John which begins, "He that is without sin among you …"
Which as a pronoun should never refer to humans. (It's an adjective in sentences like Which man do you mean?)