Adding debug logging