minor refactor, fixed error in example