Being an author myself, I can understand why movies do not follow most books on which they are based. To answer the comments made by certain individuals who were so irate in their opinions about the movie not following the book and think they know so much about producing a movie, you did not do your research. The ideas in the movie follow several of the author's stories. The rest was creative liberty taken by the screenplay writer.
Although I personally believe some scenes could have been dropped with no harm to the story, and were done strictly for sexuality and bad language, which movie makers seem to think is necessary to sell a movie, the story was done very well. Will Smith played a very believable character, in his situation.
And, by the way, Hollywood could learn a lesson from Peter Jackson with the way he did The Hobbit and The Lord of the Rings, which are clean movies. Thank you very much.