Simplified swap.rs