Added many comments, printf()s now match the spec.