Removed monkeypatching and fixed tests so that they're actually testing what they're supposed to be testing without assuming any order other than what toposort guarantees