Added a few comments to make some sense out of this.