took out print debug statments and added explanitory comments