deleted debugging prints and added some comments.