Some cleanup of the *alloc functions, with more to come.