Some adjustments on comments and explanatino. Also made some code looked simpler and easier to read.