Minor code rework and comments.