Paths file processing

This is a common pattern -- see if you can figure out how to use dict.setdefault() to make this a bit cleaner.