got rid of all file access stuff and using buffers