Use switch for setting views (thanks @mbabker)