Added tons of comments to make it easier to understand.