kami: added comments, fixed minor errors.