Fix silly bug
Fix many bugs; add debug statements