Updated resolve_deps function to use until rather then while loop