added a lot of debugging comments