Better support for profile management. Added support for instance id counting