refactor switch room, update from hao's comp originally