Properly cancel state switch tasks - DO NOT MERGE YET