update array example
clean up some ugly conditional code