Refactored so functionality of the ResourceIdentity is used in most places instead of specialized code