The generated array for diagrams, shorter code, corrected