rewrite logic to get all dependent libaries, add test cases, loop
detection