- added some debugging to code