Adds debug logging