Minor re-arrangement and better comments