adding check for allowable swap