Selects correct state but unsorted