added some comments and changed some things