routines to handle arrays