data write and read. also deleted all useless stuff (for now )