Rich D: added alternate approach using pointers to pointers, auto-allocation, retuns count, has out param