DRY up deps resolver and add some comments