began logic for switching processes