Switched to using sub instead of indexing.