Slight refactoring and clarification of comments.