fixed problem in debug code that printed the same line several times
Ran code through astyle to clean up for formatting.