added some comments and tried to fix some more.