use array expansion for simpler logic