Gabriel's Switch Code