Updated with debug logs