sample code from the book for memo