Logic to switch between fragments