improved:use array_* functions