Added IMain class and fixed issue with undefined reference to typeid in Exception classes.