(Somewhat) stable code, with File I/O

Fixed file I/O