Generator: Rewritten to use SharedPtrs.