Fixed longest pass logic