changed this example to reflect the current API