Rewrite a bunch of methods.

Use file URLs instead of paths and use newer APIs that make some old
iterations redundant.