Adapted for Swift example program "Lister"