modified some comments and arranged some codes