Switched to one-based array indexing