add a filter on record name. Improve dependency sorting code. remove old logic.