added some debug console.logs