Added debugging logging