add switch, and logic