undo debug code

more changes and fixes

minor fixes

remove temp work