Final version; added comments.