rewritten array generation