Updated readarray.c to work more dynamically