Working mode and state switching!!!