switch 0 to head and 2 to tail