small edits
debug output, refactoring