Updated to use 'switch'