Added filter dependency option, defaulting to true. Fixed the logic by finding strongly connected components and adding those as well