rewrite proc with arr-first