use lapplys ability to pass arguments to the iterator function