file i/o for memory
merged working functions so far