Setting flags for N-way