Convert if() to switch. Requires upgrade to source 1.7.