Moved debug logging to its own class