nit: I don't think you need to convert to an array if the only use is in an apply() call.