reimplement logic w/o static dep
allow optional passing of a root dir