Almost there, just gotta fix switch scoping issue