Introducing an apply function