Code cleanup
Really handle a couple error cases with realloc()