DOC: change example function name
REF: use closure to be DRYer