added console.log in right place