added some comments, still debugging