rewrite topology to make sure terminal also eariest