Reorganized and added comments.