edited the example, plus added some comments.