Modified to copy code from coursera page
Few small edits (misspellings, tabbing)