use currying to reduce impact of dom expression on js stack