minor interface change.
minor interface changes to topological sort as well.
add licence preamble