Files for input/output (much faster), some code fixes