logic swap