revise logic to allow multifile mode to actually work