updated has_swap_page logic