Mark _ReplaceFile() as static and clean it up a bit.