Rewrote file access to be cross-platform compatible