added file I/O (won't create files for some reason though. please fix this later)