Implementation of fragment switch.