added switch and reverse
fixed error in switch