Fixing Bug 418043. Dependency resolution refactor.

Signed-off-by: André Pinto <andredasilvapinto@gmail.com>