updated code to match docs.