Cleanup of debug stuff, refinement of code style