simpler code, better feature: don't assume the entry point is a dir