recursively find dependencies
added test