fixed a few bugs, added some comments