modified to match code for the example again