cleaned a few parts, added some comments