topological sorting added