added switch and arrays