Adds helper function for indexing arrays