Rules for switch and improving some other rules