fixed some issues, added debugging code