renamed some debug functions, improved output handling