added comments and changed some