First implementation, use array index