added some comments.. easier to follow