better array snippet