Adding support to configure base class on build.
Tweaked by @avdi to use an accessor.
Changing behaviour of singleton dup and clone to return self instead of nil