Refactored conjugate function