Commenting and minor bug fixes