use array to reduce code