Refactored method registeringInstances