Moved debug logging