added some comments for understanding