Bug 1068263 - Improve local file handling + other minor changes. r=jlund