Enlarging and shrinking an array