only closures know about outside variables
replaced '|->'-syntax with closures