gold master

Fixed conflicts.
fixed /n, fixed debug output.
TODO: run test cases. output to file and to console