fixed a few global things and added some comments