abstracted indexing behind an apply method, which also provides access to
individual elements