rewrite flowing logic a bit to eliminate excessive add_node/remove_node calls

also got rid of obsolete optdepends