using an apply. untested.