Cleaned up dual code