Update example code to use protocol