refactor integer swap