Refactored identity change implementation