updated code sample