Add sample code as provided by Apple