optimize nth