Made a minor change due to array indexing issues.