Fixing bugs and adding swap-rows