removed superfluous variable and added comments