watch out for memory consumption by closures