improved the switching of activities