minor changes, added some comments