Changed approach to debug logging