added console.logs to trace