added console.log() in many places