Commenting and fixing up some bugs