added some comments and removed unnececary lines.