Added a dependency detection function. Not tested yet.