added some comments and fixed something....hopefully works now