added some comments, and deleted some debug echos