Implemented task switching