first round of debugging, adding comments