Added switch and tests