Circular dependency checks working
use flat_map to save lines!