Added option for auto constructing singletons.
Moved construction of heap allocated members from init into ctor.
Used auto construct singleton for MainObject, and modified initialization order so that this works.