Shakespeare's Hamlet.

What purpose do minor/secondary characters serve in the play? how they affect hamlet and the story as a whole.