factor out dependency extraction from the sorting, test stub