Removed duplicate code
Partial conversion to talloc.

It still needs to establish the best / correct parent / child
relationship.  But for now it works