Added delegate protocol and example code.