Cleanup topsort
Add four test.